package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;

public class GetMethodTest implements Test {

	public void run() throws Throwable {
		Asserts.assertEquals(SubClassMock1.class.getMethod("getValue").toString(), "public java.lang.String org.hawk.gwtppc.webtest.tests.mock.SubClassMock1.getValue()");
		Asserts.assertEquals(SubClassMock1.class.getMethod("getValue").getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getMethod("getValue").getReturnType(), String.class);
		Asserts.assertEquals(SubClassMock1.class.getMethod("getValue").getParameterTypes().length, 0);
		
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class).toString(), "public java.lang.Appendable org.hawk.gwtppc.webtest.tests.mock.ClassMock.append(java.lang.CharSequence)");
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class).getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class).getReturnType(), Appendable.class);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class).getParameterTypes().length, 1);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class).getParameterTypes()[0], CharSequence.class);
		
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).toString(), "public java.lang.Appendable org.hawk.gwtppc.webtest.tests.mock.ClassMock.append(java.lang.CharSequence,int,int)");
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getReturnType(), Appendable.class);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getParameterTypes().length, 3);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getParameterTypes()[0], CharSequence.class);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getParameterTypes()[1], int.class);
		Asserts.assertEquals(SubClassMock1.class.getMethod("append", CharSequence.class, int.class, int.class).getParameterTypes()[2], int.class);
	}

	public String getName() {
		return "getMethod(String, Class)";
	}

}
